package com.cgbl.service.ui

import android.os.Bundle
import android.widget.ImageView
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
import com.cgbl.service.BR
import com.cgbl.service.R
import com.cgbl.service.databinding.AppActivityPersonalProfileBinding
import com.cgbl.service.vm.PersonalProfileViewModel
import com.robot.base.base.activity.GLBaseActivity
import com.robot.base.configs.AppConstants

@Route(path = AppConstants.Router.Project.A_PERSONAL_PROFILE)
class PersonalProfileActivity :
    GLBaseActivity<AppActivityPersonalProfileBinding, PersonalProfileViewModel>() {

    var id = ""
    override fun initContentView(savedInstanceState: Bundle?): Int =
        R.layout.app_activity_personal_profile

    override fun initVariableId(): Int = BR.viewModel

    override fun initComponents() {
        initTiterBar()
        viewModel.fetchUserInfo(id)
    }

    private fun initTiterBar() {
        val titleView = findViewById<TextView>(R.id.tv_title)
        val backView = findViewById<ImageView>(R.id.iv_back)
        titleView?.text = "个人资料"
        backView?.setOnClickListener { finish() }
    }

    override fun initParam() {
        id = intent.getStringExtra(AppConstants.BundleKey.ID) ?: ""
    }
}